# -*- coding: utf-8 -*-
#
# SConscript for building the MahJong-Night client.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 3 of the License.
#
# Author: VestniK (Sergey N.Vidyuk)
# Date: 18 Jun 2009
from get_files import *

Import('BaseEnv SrvLib')
# Creating main construction environments
client = BaseEnv.Clone()
common_lib = BaseEnv.Clone()
# Defining build options for client common library
common_lib.Append(CPPPATH='common')
common_lib.Append(CPPPATH='#server')
common_lib.Append(CPPPATH='#services')
common_lib.Prepend(LIBS = [SrvLib])
common_lib.EnableQt4Modules(['QtCore','QtNetwork'])
LibSources = get_files_list("common","\.cpp$",["moc_.*\.cpp$"])
LibSources += client.QRSClient('#services/session.xml')
LibSources += client.QRSClient('#services/player.xml')
LibSources += client.QRSClient('#services/game.xml')
lib = common_lib.Library('MjnClient',LibSources)

# Defining build options for the client gui library
guiLibEnv = client.Clone()
guiLibEnv.Append(CPPPATH='gui')
guiLibEnv.Append(CPPPATH='common')
guiLibEnv.Append(CPPPATH='#server')
guiLibEnv.Append(CPPPATH='#services')
guiLibEnv.Append(LIBS = [SrvLib,lib])
guiLibEnv.EnableQt4Modules(["QtCore","QtGui","QtNetwork",'QtSvg'])
GuiSources = get_files_list("gui","\.cpp$",["moc_.*\.cpp$",'qrc_.*\.cpp'])
Forms = get_files_list("gui","\.ui$",[])
interface = guiLibEnv.Uic4(Forms)
guiLib = guiLibEnv.Library('MjnClientGui',GuiSources)

# Defining build options for client application
client.Append(CPPPATH='.')
client.Append(CPPPATH='gui')
client.Append(CPPPATH='common')
client.Append(CPPPATH='#server')
client.Append(CPPPATH='#services')
client.EnableQt4Modules(["QtCore","QtGui","QtNetwork",'QtSvg','QtOpenGL'])
client.Append(LIBS = [guiLib,SrvLib,lib,'GLU'])
# Setting up sources and builders
AppSources = ['mahjong-night.cpp']+client.Qrc(['gui/client.qrc'])
mahjong_night = client.Program('mahjong-night',AppSources)

client.InstallProgram(mahjong_night)

BaseEnv['GUI_LIB'] = guiLib
Return('lib')
